'''universal modules to build out webpage basics'''
from django.db.models import get_models

def main_menu():

    main_list = []
    exclude_list = ['ContentType',
        'Permission',
        'Group',
        'Message',
        'Session',
        'LogEntry',
        'lease_term',
        'license_type',
        'system_type',
        'software',
        'asset_type',
        'asset_tag',
        'network_transport_type',
        'network_transport',
        'device_type',
        'device_status',
        'component_type',
        'peripheral_type',
        'end_user_system_type',
        ]
    no_sub_list = ['User']
    sub_exclude_list = ['id','notes']

    for model in get_models():
        y = model.__name__, [x.name for x in model._meta.fields]
        if model.__name__ not in exclude_list:
            main_list.append(y)
    print "<ul class=\"menu_body\">"
    for i in main_list:
        print "<li><a href=\"/%s\">%s</a></li>" % (i[0], i[0])
 # logic to print submenus.  not  currently used
 #       if i[0] not in no_sub_list:
 #           print "<ul>"
 #           for j in range(len(i[1])):
 #               if i[1][j] not in sub_exclude_list:
 #                   print "<li><a href=\"/%s/%s\">%s</a></li>" % (i[0], i[1][j], i[1][j])
 #           print "</ul>"
    print "</ul>"

